<%@page import="tianqi.entity.UserY"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>添加购物车</title>
    <link rel="stylesheet" type="text/css" href="css/orderSubmit.css">
    <script type="text/javascript" charset="utf-8" src="js/jquery-1.11.3.js"></script>
</head>
<body>
	<div id="header" class="clear logo_top">
    <a href="${pageContext.request.contextPath}/youge.tq" class="lf"><img src="img/lpay.jpg" alt="购物车"/></a>
    <a href="${pageContext.request.contextPath}/youge.tq" class="rt"><img src="img/tiao_gwc.png" alt="购物车"/></a>
</div>

<div id="contain">
${msg }
   					
</div>


<div id="orderD" style="border-top:0;overflow:hidden; border-top:1px solid #e6e6e6;" class="bg clear">
   <form id="form1" action="${pageContext.request.contextPath}/orderPay.tq" method="post">
   	<input id="yx" name="orderId" value="" type="hidden">
    <table id="addrList" cellspacing="0" cellpadding="0" border="0" width="100%">
        <tbody><tr>
            <th width="100">订单号</th>
            <th width="210">订单商品</th>
            <th width="10%">收货人</th>
            <th width="100">订单金额</th>
            <th width="20%">
                下单时间
            </th>
            <th width="88">
               订单状态
            </th>
            <th width="10%">操作</th>
        </tr>
        
        <c:forEach items="${order}" var="order">
        <tr id="${order.orderId }">
        	<input <c:if test="${order.orderState=='0'}">data-name='o'</c:if> value="${order.orderId }" type="hidden">
            <td><a href="#">${order.orderId }</a></td>
            <td>
                <div class="t">
                    <ul>
                    <c:forEach items="${order.orderDetail}" var="d">
                    
                        <li><div class="t-img"><a target="_blank" href="#"><img src="${d.proImg }"></a></div></li>
                    </c:forEach>
                    </ul>
                </div>
            </td>
            <td width="10%">${order.getproUname }</td>
            <td>￥${order.orderMoney }</td>
            <td width="20%" class="hui">${order.date }</td>
            <td><span class="hui">${order.orderState=='1'?'已付款':'未付款' }</span></td>
            <td width="10%">
            
            	<c:choose>
   				<c:when test="${order.orderState=='1' }"> 
   				 <a href='${pageContext.request.contextPath}/deleteOrderById.tq?id=${order.orderId }'>反馈</a> ｜<a target='_blank' href='${pageContext.request.contextPath}/shareOrder.tq?orderId=${order.orderId }'>晒单</a>
   				</c:when>
   				<c:otherwise>
   					<a href='${pageContext.request.contextPath}/deleteOrderById.tq?id=${order.orderId }'>取消</a> ｜<a target='_blank' href='javascript:form1SubmitD("${order.orderId }");'>付款</a>
   				</c:otherwise>
			</c:choose>
                
            </td>
        </tr>
        </c:forEach>
        </tbody>
    </table>

</form>
</div>

<div class="tit" id="paytitle">
    <h2>付款方式</h2>
</div>

<div id="payfs" class="lb_tit">
    <span style="font-size:12px; float:left; color:#333333; padding-left:5px; font-weight:bold;">网上银行</span>
    <span style="color:#929292; margin-left:8px;">由支付宝提供接口，会转至银行页面完成支付，确保您的资金安全，推荐使用</span>
</div>


    <div id="payfs1" class="bank">
        <ul>
            <li><input name="payment" class="payment" type="radio" value="w-ICBCB2C"><label><img style="border: 1px solid #ddd;" src="img/zfb.jpg" title="中国工商银行"></label></li>
        </ul>
    </div>

    <div class="lb_tit" style="display:none;">
        <span style="font-size:12px; float:left; color:#333333; padding-left:5px; font-weight:bold;">信用卡大额快捷支付</span>
        <span style="color:#929292; margin-left:8px;">信用卡快捷支付，无需网银，使用于单笔大额交易</span>
    </div>

    <div class="pay_fk">
        <div class="wenben">
            <p></p>
            <div class="jiesuanxinxi">
                <div class="jine">
                    <div style="margin-top:15px;">应付金额：<span style="font-family:&#39;微软雅黑&#39;; font-size:35px; color:#ff4400;">￥</span><span style="font-size:35px; color:#ff4400; font-family:Arial;">${moneys }</span>元</div>
                </div>
            </div>

            <div class="yingfu">
                <a id="paynow" href="javascript:form1Submit();">立即付款</a><a class="fanhui_xiugai" href="#">返回我的账户</a>
            </div>
        </div>

    </div>
    <input name="oid" type="hidden" value="759178">


	<script type="text/javascript" charset="utf-8">
		function deleteTr(orderId){
			$.ajax({
			      type:"post",
			      url:"${pageContext.request.contextPath}/deleteOrderById.tq",
			      data:{
			    	  id:orderId
			      },
			      success:function(data){
			        console.log(data)
			        if(data == '1'){
			        	alert("删除成功");
			        	$("#"+orderId).remove();
			        }else{
			        	alert("删除失败");
			        }
			      },
			      error:function(data){
			        alert("系统错误");
			        console.log(data);
			        return;
			      }
			    });
		}
	function form1Submit(){
		$("#yx").val("");
			var str="";
			$("#addrList input[data-name='o']").each(function(){
				str+=$(this).val()+",";
		});
			$("#yx").val(str.substr(0,str.length-1));
			var orderId=$("#yx").val();
			if (orderId == "" || orderId ==null || orderId==" " || !orderId) {
				alert("没有可提交的订单！");
				return;
			}
			alert(orderId);
			$("#form1").submit();
		}
	function form1SubmitD(o){
		
		$("#yx").val("");
			$("#yx").val(o);
			alert($("#yx").val());
			$("#form1").submit();
		}
	</script>


</body>
</html>